![]() |
SetOrigin |
||||
Header: | Quickdraw.h | Carbon status: | Supported | |
Changes the coordinates of the window origin of the port rectangle of the current graphics port (basic or color).
void SetOrigin ( SInt16 h, SInt16 v );
The horizontal coordinate of the upper-left corner of the port rectangle.
The vertical coordinate of the upper-left corner of the port rectangle.
The SetOrigin function changes the coordinates of the upper-left corner of the current graphics port’s port rectangle to the values supplied by the h and v parameters. All other points in the current graphics port’s local coordinate system are calculated from this point. All subsequent drawing and calculation functions use the new coordinate system.
The SetOrigin function does not affect the screen; it does, however, affect where subsequent drawing inside the graphics port appears. The SetOrigin function does not offset the coordinates of the clipping region or the graphics pen, which therefore change position on the screen (unlike the boundary rectangle, port rectangle, and visible region, which don’t change position onscreen).
Because SetOrigin does not move the window’s clipping region, use the GetClip function to store your clipping region immediately after your first call to SetOrigin—if you use clipping regions in your windows. Before calling your own window-drawing function, use the ClipRect function to define a new clipping region—to avoid drawing over your scroll bars, for example. After calling your own window-drawing function, use the SetClip function to restore the original clipping region. You can then call SetOrigin again to restore the window origin to a horizontal coordinate of 0 and a vertical coordinate of 0 with your original clipping region intact.
All other functions in the Macintosh Toolbox and Operating System preserve the local coordinate system of the current graphics port. The SetOrigin function is useful for readjusting the coordinate system after a scrolling operation.
Note that the Window Manager and Control Manager always assume the window’s upper-left point has a horizontal coordinate of 0 and a vertical coordinate of 0 when they draw in a window. Therefore, if you use SetOrigin to change the window origin, be sure to use SetOrigin again to return the window origin to a horizontal coordinate of 0 and a vertical coordinate of 0 before using any Window Manager or Control Manager functions.
Supported in Carbon. Available in CarbonLib 1.0 and later when InterfaceLib 7.1 or later is installed. Exported by CarbonLib 1.0 and later and by InterfaceLib 7.1 and later.
© 2000 Apple Computer, Inc. — (Last Updated 4/14/2000)